home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
basic
/
qbser320.zip
/
QBSERIAL.DOC
< prev
next >
Wrap
Text File
|
1993-09-07
|
47KB
|
953 lines
QBserial version 3.20
Serial I/O Routines for QB 4.x, BC 7.x, VBDOS, & FOSSIL Drivers
This library will provide you with serial I/O communications
routines for use in QuickBASIC 4.x (with or without PDQ), the
Microsoft Basic Compiler 7.x Professional Development System, and
Visual Basic for DOS 1.x. No longer are you forced to use the poor
communications support provided by QB. This program will allow you
to control 8250 and 16450 type communications ports (UARTS) at
speeds of up to 115200 baud. Communication ports 1 - 4, and non-
standard addresses are supported. You will no longer have problems
with the DTR signal. DTR is left in the same state it was in when
before you called this driver, or it can be controlled by your
program. The serial driver includes XON/XOFF and CTS/RTS
handshaking. Serial input is interrupt driven, using any IRQ you
specify (1 - 15), with incoming XOFF flow control (if enabled), or
RTS flow control (if enabled) to prevent overrunning the input
buffer. This is referred to as "Normal" mode.
This driver also has a mode where it will operate with FOSSIL
drivers (INT 14h interface). Using FOSSIL mode allows you to use
virtually any type of communications hardware, since the type of
hardware accessed is dependant on the FOSSIL driver. This mode
requires that you have a FOSSIL driver loaded in advance. This is
referred to as "FOSSIL" mode.
The driver was written with Microsoft's C, and compiled with
version 6.0a of that compiler. This driver is useable with
QuickBASIC version 4.x, and Basic Compiler 6.x & 7.x PDS (With or
without PDQ), and Visual Basic for DOS version 1.x. Basic Compiler
1.x, QuickBASIC 2.x, and 3.x are not supported by this driver. The
reason is that versions of QuickBASIC prior to 4.0 do not support
the extensive multi-language interface that QB4.x has (via the
DECLARE statement and Microsoft language extensions). Throughout
this manual QB will be used to refer to both QuickBASIC, the Basic
Compilers (6.x & 7.x PDS), and Visual Basic for DOS.
Before the driver can be used, the following INCLUDE statement must
be added to the beginning of your QB program:
' $INCLUDE: 'qbserial.dec'
The declarations included by this statement specify all the entry
points into the serial driver. DO NOT change them or the driver
will not function.
Refer to the included sample programs SIMPLE.BAS, PCBDOOR.BAS, and
OFFHOOK.BAS. they use most of the calls described below.
QBSERIAL User Manual - V 3.20 Page 1
Qbserial has two (2) modes of operation: Normal and FOSSIL. The
mode you operate in is specified in the OpenComm statement (The
FOS% parameter). In the following sections, where applicable, each
parameter will be explained as to how it operates in both Normal
and FOSSIL mode.
Port Initialization
OpenComm Port%, IRQ/Stat%, Wlen%, Parity%, Bits%, Baud&, HS%, FOS%
Parameter: Port%
Normal: If the specified port is 1 to 4, the driver opens that
port. If you specify the port as ZERO (0) the driver
enters "LOCAL" mode. This allows you to call the driver
with data, but the driver won't send anything. This is
useful when working with "doors". if you specify the port
as any other value, QBserial will use that as the base
address for the port. This allows you to work with non-
standard I/O addresses. Note however that if you open a
non-standard port, you must specify an IRQ value from 1
to 15 - There is no default IRQ when used in this manner.
FOSSIL: Unlike normal mode, "port" does not necessarily relate to
a specific communications port or address. Using a "1"
for a port value does NOT necessarily mean COM1. Also
unlike QBserial's normal mode, a value other than 1 - 4
does NOT refer to a base address of a UART.
When using FOSSIL mode, "port" refers to a logical
device. Port 0 is the first port of a FOSSIL device
driver, Port 1 the second, and so on. When used with
drivers such as X00.SYS (assuming you didn't remap the
ports), port 0 refers to COM1, and port 1 refers to COM2.
This will vary depending on the FOSSIL driver used and
the device(s) referenced. In most cases it is determined
when the FOSSIL driver is installed through some sort of
configuration file (or command line options) that relates
the physical devices to logical port numbers. However, in
order to make the FOSSIL implementation as compatible as
possible with "normal" mode, the port number passed will
have a value of ONE (1) subtracted from it before
referring to the actual FOSSIL port. Therefore to access
the first port (port 0), you pass a 1 as you did with in
normal mode. Internally, one (1) is subtracted so that
port 0 is referenced. This makes the implementation or
normal and FOSSIL modes totally transparent.
Specifying a value of ZERO (0) for the port puts the
driver in "local" mode. This is identical to normal mode.
QBSERIAL User Manual - V 3.20 Page 2
Parameter: IRQ/Stat%
Normal: Specifies which interrupt to use with this port. If the
value of IRQ% is ZERO (0), then the default IRQ values
are used (COM1 & COM3 use IRQ4, COM2 & COM4 use IRQ3).
This is what most applications will use. Specify an IRQ
value of 1 through 15 when you want to use an IRQ value
other than the default. Such as when you want to use
IRQ15 with COM3. NOTE: Be careful when choosing an IRQ
value other than the default. Most machines use some of
the other IRQ inputs for other machine functions such as
the Hard drive and system clock. QBserial DOES NOT chain
the interrupt, it takes it over entirely. If you choose
an IRQ that is used for something already, your machine
will most certainly operate improperly.
FOSSIL: No IRQ value is necessary in FOSSIL mode since all
communications tasks are handled outside of QBserial. The
IRQ used with a particular "port" will be determined at
the time the FOSSIL driver is installed, probably through
the same configuration method mentioned above.
When using FOSSIL mode, this field is now Status. This is
a value RETURNED to the programmer when OpenComm has
completed. It indicates whether or not the FOSSIL driver
initialized properly and is ready to perform
communications tasks. A value of 1954h (HEX) or 6484
(DECIMAL) indicates a successful initialization. ANY
OTHER value indicates a initialization failure.